<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@include file="/page/common/public.jspf"%>
<!DOCTYPE HTML>
<html>
<head>
<meta charset=utf-8" />
<title>项目详情-${borrowInfo.borrowName }</title>
<meta name="viewport" content="width=1000, initial-scale=0.9"/>
<link rel="stylesheet" type="text/css" href="${path}/css/base.css"/>
<link rel="stylesheet" type="text/css" href="${path}/css/layout.css"/>
<script src="${path }/js/common/jquery1.10.2.min.js"></script>
<script src="${path }/js/common/helper.js?v=${v}"></script>
<script src="${path }/js/common/cookie.js?v=${v}"></script>
<script src="${path }/js/invest/invest.js?v=${v}"></script>
<script src="${path }/js/timeCountDown.js?v=${v}"></script>
<script type="text/javascript">
function selectTag(showContent,selfObj){
	// 操作标签
	var tag = document.getElementById("tags").getElementsByTagName("li");
	var taglength = tag.length;
	for(i=0; i<taglength; i++){
		tag[i].className = "mt_link2";
	}
	selfObj.className = "mt_hover2";
	// 操作内容
	for(i=0; j=document.getElementById("tagContent"+i); i++){
		j.style.display = "none";
	}
	document.getElementById(showContent).style.display = "block";
}
</script>
</head>

<body bgcolor="#f9f9f9">
<input type="hidden" id="bidStopyear" value="<fmt:formatDate value="${borrowInfo.bidStopTime}" type="both" pattern="yyyy"/>"/>
<input type="hidden" id="bidStopmonth" value="<fmt:formatDate value="${borrowInfo.bidStopTime}" type="both" pattern="MM"/>"/>
<input type="hidden" id="bidStopday" value="<fmt:formatDate value="${borrowInfo.bidStopTime}" type="both" pattern="dd"/>"/>
<input type="hidden" id="bidStophour" value="<fmt:formatDate value="${borrowInfo.bidStopTime}" type="both" pattern="hh"/>"/>
<input type="hidden" id="bidStopmin" value="<fmt:formatDate value="${borrowInfo.bidStopTime}" type="both" pattern="mm"/>"/>
<input type="hidden" id="bidStopss" value="<fmt:formatDate value="${borrowInfo.bidStopTime}" type="both" pattern="ss"/>"/>
<!-- head -->
<c:import url="../include/top.jsp">
	<c:param name="type" value="wytz"></c:param>
</c:import>

<div class="youarehere">
	<div class="localtion"><a href="${path }/">首页</a> > <a href="${path }/borrowInfo/list.htm">我要投资</a> > ${borrowInfo.borrowName }</div>
</div>		

<div class="wrap f_yh">
	<div class="box detail_div">
		<div class="title"><h2 class="l">${borrowInfo.borrowName }</h2><span class="r">发布时间：<fmt:formatDate value="${borrowInfo.bidOpenTime}" type="both" pattern="yyyy-MM-dd"/></span></div>
	
<div class="detail_div_cont" style="overflow: auto;">
		<div class="l_div">
                	<div class="l"><img src="${path }/images/xm0819_03.jpg" /></div>
                	<div class="l" style="width:470px;margin-left: 10px;">
                    	<table cellpadding="0" cellspacing="0" width="100%" class="de_Table">
                        	<tr class="th">
                            	<td style="padding-left: 0px;"><span>预期年化利率</span><br />
                            	 <div class="fSize_24 f_orange">
                            	 <input type="hidden" id="rewardRate" value="${borrowInfo.rewardRate}"/>
                            	 <input type="hidden" id="borrowRate" value="${borrowInfo.borrowRate}"/>
                            	 ${borrowInfo.borrowRate}% 
                                </div>
                            	</td>
                                <td><span>投资期限</span><br />
                                <div class="fSize_24">
                                <input type="hidden" id="borrowDuration" value="${borrowInfo.borrowDuration}"/>
                    		    <input type="hidden" id="durType" value="${borrowInfo.durType}"/>
                                ${borrowInfo.borrowDuration}个月
                                </div>
                                </td>
                                <td style="border-right-width: 0"><span>借款总金额</span><br />
                                <div class="fSize_24"><c:choose>
									    <c:when test="${borrowInfo.borrowMoney/100/10000 >= 1}">
									    	<fmt:formatNumber value="${borrowInfo.borrowMoney/100/10000}" pattern="#0"></fmt:formatNumber>  
									    </c:when>
									    <c:otherwise>
									    	${borrowInfo.borrowMoney/100/10000}
									    </c:otherwise>   
									  </c:choose>万元
								</div>	
                                
                                </td>
                            </tr>
                            <tr><td colspan="3" style="padding-top: 20px;"><div style="border-top:1px dashed #E2E2E2;height: 12px;"></div></td></tr>
                            <tr>
                              <td colspan="3" class="bt_de">
                              <table width="100%" border="0">
                                <tr>
                                  <td>保障方式：本息全额担保</td>
                                  <td>还款方式：${borrowInfo.repaymentType.text }</td>
                                </tr>
                                <tr>
                                  <td>担保机构：${borrowInfo.guaranteeRealName }</td>
                                  <td>投标截止：<fmt:formatDate value="${borrowInfo.bidStopTime}" type="both" pattern="yyyy-MM-dd"/></td>
                                </tr>
                                <tr>
                                  <td colspan="2">剩余时间：<span class="countdown_row countdown_amount hasCountdown" id="leftTime">
			                        	<c:choose>
											<c:when test="${borrowInfo.status eq 'RAISE' }">
												<span class="countdown_row countdown_amount" id="countdown_row"></span>
											</c:when> 
											<c:otherwise>
												<span class="countdown_row countdown_amount"></span>
											</c:otherwise> 
										</c:choose>
			                        </span></td>
                                </tr>
                                <tr>
                                  <td colspan="2"><span class="l">项目进度：</span><div class="jdt_div l"><div style="width: 10.0%;" class="bfb"></div></div> 10%</td>
                                </tr>
                              </table></td>
                            </tr>
                        </table>
                    </div>
		</div>
		
		<div class="r_div">
                        
                        
                        <c:choose>
							<c:when test="${borrowInfo.status eq 'RAISE' }">
								<p style="margin-top: 20px;">账户可用余额： 
									<c:if test="${empty usersession}"><!--未登陆  -->
						          		<a href="<%=request.getContextPath()%>/page/login/login.jsp">登录</a> 后可见
						          	</c:if>
						          	<c:if test="${not empty usersession}"><!-- 已登陆 -->
						          		<fmt:formatNumber value="${usersession.account.baseMoney/100 - usersession.account.freezeMoney/100}" type="currency" pattern="￥"/>元
						          	</c:if>
								</p>
		                    	
		                        <p><span id="invest_err_msg" style="color: red;"></span></p>
		                        <p class="fSize_24 f_orange">
		                        	<input name="investMoney" id="investMoney" maxlength="6" placeholder="${borrowInfo.minInvest / 100}元起投" class="inputSum" type="text"/><span>元</span>
		                        </p>
		                        <p class="profit">预期收益：<em>¥<span id="espectMoney"></span></em></p>
		                        <div class="marginT_20">
		                        	<input  type="button" name="investBtn" id="investBtn" value="确定投资" class="bt" />
									<input type="hidden" name="borrowInfoId" id="borrowInfoId" value="${borrowInfo.id}"/>
		                        </div>
							</c:when> 
							<c:otherwise>
								<c:choose>
									<c:when test="${borrowInfo.status eq 'END'}">
										<div class="plan_given">
											<div class="plan_given_btn">
												<i class="ui_full ui_plan_bj"></i>
											</div>
										</div>
									</c:when>
									<c:when test="${borrowInfo.status eq 'LOANING'}">
										<div class="plan_given">
											<div class="plan_given_btn">
												<i class="ui_df ui_plan_bj"></i>
											</div>
										</div>
									</c:when>
									<c:when test="${borrowInfo.status eq 'REPAYMENTING'}">
										<div class="plan_given">
											<div class="plan_given_btn">
												<i class="ui_pay ui_plan_bj"></i>
											</div>
										</div>
									</c:when>
									<c:when test="${borrowInfo.status eq 'REPAYMENTED'}">
										<div class="plan_given">
											<div class="plan_given_btn">
												<i class="ui_paid ui_plan_bj"></i>
											</div>
										</div>
									</c:when>
								</c:choose>
							</c:otherwise> 
						</c:choose>
                        

		</div>
		</div>
</div>
</div>

    	<!--主体-->
        <div class="pageCenter registeredBox" style="margin-top: 20px;border: 1px solid #DDDDDD">
        	<div class="activationBox">
                <div class="mt_sportBox2" style="min-height:800px;">           
                    <ul class="mt_sportBoxHead2" id="tags">
                        <li class="mt_hover2" onclick="selectTag('tagContent0',this)"><span>标的详情</span></li>
                        <li class="mt_link2" onclick="selectTag('tagContent1',this)"><span>风控信息</span></li>
                        <li class="mt_link2" onclick="selectTag('tagContent2',this)"><span>抵押物信息</span></li>
                        <li class="mt_link2" onclick="selectTag('tagContent3',this)"><span>相关文件</span></li>
                        <li class="mt_link2" onclick="selectTag('tagContent4',this)"><span>还款计划</span></li>
                        <li class="mt_link2" onclick="selectTag('tagContent5',this)"><span>投资记录</span></li>
                        <li class="mt_link2" onclick="selectTag('tagContent6',this)"><span>活动详情</span></li>
                    </ul>
                    <div class="clear_both mt_sportBoxContent2" style="margin: 10px;font-size: 14px;">
                        <div style="display: block;" id="tagContent0">
                            <table width="100%" border="0" align="center" cellpadding="6" cellspacing="1" class="productdetail_cont"> 
								<tr>
									<td colspan="6" align="left" bgcolor="#FFFFFF" class="productdetail_title"><h3>产品详情</h3></td>
								</tr> 
								<tr>
									<td align="right" bgcolor="#FFFFFF" class="left_t">标的名称</td>
									<td align="left" bgcolor="#FFFFFF" class="right_t">${borrowInfo.borrowName}</td>
									<td align="right" bgcolor="#FFFFFF" class="left_t">担保人</td>
									<td align="left" bgcolor="#FFFFFF" class="right_t">${borrowInfo.guaranteeRealName}</td>
									<td align="right" bgcolor="#FFFFFF" class="left_t">借款人</td>
									<td align="left" bgcolor="#FFFFFF" class="right_t">${borrowInfo.borrowUserName}</td>
								</tr>
								<tr>
									<td align="right" bgcolor="#FFFFFF" class="left_t">融资总额</td>
									<td align="left" bgcolor="#FFFFFF" class="right_t">
										<c:choose>
										    <c:when test="${borrowInfo.borrowMoney/100/10000 >= 1}">
										    	<fmt:formatNumber value="${borrowInfo.borrowMoney/100/10000}" pattern="#0"></fmt:formatNumber>  
										    </c:when>
										    <c:otherwise>
										    	${borrowInfo.borrowMoney/100/10000}
										    </c:otherwise>   
										  </c:choose>万元
									</td>
									<td align="right" bgcolor="#FFFFFF" class="left_t">借款周期(${borrowInfo.durType.text})</td> 
									<td align="left" bgcolor="#FFFFFF" class="right_t">${borrowInfo.borrowDuration}</td>
									<td align="right" bgcolor="#FFFFFF" class="left_t">借款利率</td>
									<td align="left" bgcolor="#FFFFFF" class="right_t">${borrowInfo.borrowRate}</td>
								</tr>
								<tr>
									<td align="right" bgcolor="#FFFFFF" class="left_t">
										<!--  附加利率-->投标增量金额
									</td>
									<td align="left" bgcolor="#FFFFFF" class="right_t">
										<!--${borrowInfo.rewardRate}  -->${borrowInfo.incMoney / 100}元
									</td>
									<td align="right" bgcolor="#FFFFFF" class="left_t">融资期限(小时)</td>
									<td align="left" bgcolor="#FFFFFF" class="right_t">${borrowInfo.raiseDuration}</td>
									<td align="right" bgcolor="#FFFFFF" class="left_t">融资进度</td>
									<td align="left" bgcolor="#FFFFFF" class="right_t"><fmt:formatNumber type="number" value="${(borrowInfo.raiseMoney / borrowInfo.borrowMoney) * 100}" maxFractionDigits="1"/>%</td>
								</tr>
								<tr>
									<td align="right" bgcolor="#FFFFFF" class="left_t">还款方式</td>
									<td align="left" bgcolor="#FFFFFF" class="right_t">${borrowInfo.repaymentType.text}</td>
									<td align="right" bgcolor="#FFFFFF" class="left_t">最小投标金额</td>
									<td align="left" bgcolor="#FFFFFF" class="right_t">${borrowInfo.minInvest / 100}元</td>
									<td align="right" bgcolor="#FFFFFF" class="left_t">最大投标金额</td>
									<td align="left" bgcolor="#FFFFFF" class="right_t">${borrowInfo.maxInvest / 100}元</td>
								</tr>
								<tr>
									<td align="right" bgcolor="#FFFFFF" class="left_t">已融金额</td>
									<td align="left" bgcolor="#FFFFFF" class="right_t">${borrowInfo.raiseMoney/100}</td>
									<td align="right" bgcolor="#FFFFFF" class="left_t">已融人数</td>
									<td align="left" bgcolor="#FFFFFF" class="right_t">${borrowInfo.raiseNum}</td>
									<td align="right" bgcolor="#FFFFFF" class="left_t">抵押说明</td>
									<td align="left" bgcolor="#FFFFFF" class="right_t">${borrowInfo.mortgageDesc}</td>
								</tr>
								<tr>
									<td align="right" bgcolor="#FFFFFF" class="left_t">标的描述</td>
									<td align="left" bgcolor="#FFFFFF" class="right_t">${borrowInfo.remark}</td>
									<td align="right" bgcolor="#FFFFFF" class="left_t"></td>
									<td align="left" bgcolor="#FFFFFF" class="right_t"></td>
									<td align="right" bgcolor="#FFFFFF" class="left_t">
									<!--借款管理费率-->
									
									</td>
									<td align="left" bgcolor="#FFFFFF" class="right_t">
									<!--${borrowInfo.managerFeeRate}  -->
									</td>
								</tr>
							</table>
                        </div>
                        <div style="display:none;" id="tagContent1"><!--风控信息  -->
                           	<table style="width: 100%;" border="0">
                           		<tr>
                           			<td align="left" style="font-size: 14px;font-weight: bold;">担保机构：</td>
                           		</tr>
                           		<tr>
                           			<td align="left">${borrowInfo.guaranteeRealName }</td>
                           		</tr>
                           		<tr>
                           			<td align="left" style="font-size: 14px;font-weight: bold;">担保机构介绍：</td>
                           		</tr>
                           		<tr>
                           			<td align="left">${borrowInfo.guaranteeDesc}</td>
                           		</tr>
                           		<tr>
                           			<td align="left" style="font-size: 14px;font-weight: bold;">担保情况：</td>
                           		</tr>
                           		<tr>
                           			<td align="left">${borrowInfo.guaranteeCondition }</td>
                           		</tr>
                           		<tr>
                           			<td align="left" style="font-size: 14px;font-weight: bold;">风险控制措施：</td>
                           		</tr>
                           		<tr>
                           			<td align="left">${borrowInfo.dangerDesc }</td>
                           		</tr>
                           		<tr>
                           			<td align="left" style="font-size: 14px;font-weight: bold;">反担保情况：</td>
                           		</tr>
                           		<tr>
                           			<td align="left">${borrowInfo.fguaranteeCondition }</td>
                           		</tr>
                           	</table>
                        </div>
                        <div style="display:none;" id="tagContent2"><!--抵押物信息  -->
                           	<table style="width: 100%;" border="0">
                           		<tr>
                           			<td align="left" style="font-size: 14px;font-weight: bold;">抵押说明</td>
                           		</tr>
                           		<tr>
                           			<td align="left">${borrowInfo.mortgageDesc }</td>
                           		</tr>
                           		<tr>
                           			<td align="left" style="font-size: 14px;font-weight: bold;">股权：</td>
                           		</tr>
                           		<tr>
                           			<td align="left">${borrowInfo.mortgage_stock}</td>
                           		</tr>
                           		<tr>
                           			<td align="left" style="font-size: 14px;font-weight: bold;">房产：</td>
                           		</tr>
                           		<tr>
                           			<td align="left">${borrowInfo.mortgage_house }</td>
                           		</tr>
                           		<tr>
                           			<td align="left" style="font-size: 14px;font-weight: bold;">土地：</td>
                           		</tr>
                           		<tr>
                           			<td align="left">${borrowInfo.mortgage_land }</td>
                           		</tr>
                           		<tr>
                           			<td align="left" style="font-size: 14px;font-weight: bold;">实物：</td>
                           		</tr>
                           		<tr>
                           			<td align="left">${borrowInfo.mortgage_stuff }</td>
                           		</tr>
                           		<tr>
                           			<td align="left" style="font-size: 14px;font-weight: bold;">其他资产：</td>
                           		</tr>
                           		<tr>
                           			<td align="left">${borrowInfo.mortgage_other }</td>
                           		</tr>
                           	</table>
                        </div>
                        <div style="display:none;" id="tagContent3"><!--相关文件  -->
                           	<img alt="银行开户行许可证文件" style="width: 200px;height: 200px;" src="${borrowInfo.bankpermitfilepath }"/></br>
                           	<img alt="身份证背面" style="width: 200px;height: 200px;" src="${borrowInfo.idbackfilepath }"/></br>
                           	<img alt="身份证前面" style="width: 200px;height: 200px;" src="${borrowInfo.idfrontfilepath }"/></br>
                           	<a href="${borrowInfo.profitfilepath }">上年度利润报表文件</a>
                        </div>
                        <div style="display:none;" id="tagContent4"><!--还款计划  -->
                           	<div class="lendDetailTab_divContent_Div">
			                   <ul class="clearfix">
			                       <li class="w266">返还日期</li>
			                       <li class="w137" style="width: 180px;">应还本息（￥）</li>
			                       <li class="w137" style="width: 160px;">总期数</li>
			                       <li class="w137" style="width: 180px;">当前期数</li>
			                       <li class="w137" style="width: 180px;">状态</li>
			                   </ul>
			                   <c:forEach items="${repaymentList}" var="repayment">
				                   <ol>
				                       <li class="w266"><fmt:formatDate value="${repayment.lastRepayDate}" type="both" pattern="yyyy/MM/dd hh:mm:ss"/></li>
				                       <li class="w144" style="width: 180px;"><fmt:formatNumber value="${repayment.repayMoney/100}" type="currency" pattern="￥.0"/></li>
				                       <li class="w144" style="width: 160px;">${repayment.totalRepayNum}</li>
				                       <li class="w144" style="width: 180px;">${repayment.curRepayNum}</li>
				                       <li class="w137" style="width: 180px;">${repayment.status.text}</li>
				                   </ol>
			                   </c:forEach>
			               </div>
                        </div>
                        <div style="display:none;" id="tagContent5"><!--投标计划  -->
                            <div class="lendDetailTab_divContent_Div">
				                 <ul class="clearfix">
				                     <li class="w144" style="width: 254px;">投资人</li>
				                     <li class="w144">等级</li>
				                     <li class="w144" style="width: 180px;">投资金额（￥）</li>
				                     <li class="w137" style="width: 180px;">投资时间</li>
				                     <li class="w137" style="width: 180px;">状态</li>
				                 </ul>
				                 <c:forEach items="${investList}" var="invest">
					                 <ol>
					                     <li class="w144" style="width: 254px;">
						                     <c:choose> 
						                     	 <c:when test="${empty invest.investUserName}"></c:when> 
											     <c:when test="${fn:length(invest.investUserName) > 2}"> 
											      	<c:out value="${fn:substring(invest.investUserName, 0, 2)}***" /> 
											     </c:when> 
											     <c:otherwise> 
											      	<c:out value="${invest.investUserName}***" /> 
											     </c:otherwise>
										     </c:choose>
					                     </li>
					                     <li class="w144">${invest.userLevel}级</li>
					                     <li class="w144" style="width: 180px;">¥${invest.investMoney / 100}</li>
					                     <li class="w137" style="width: 180px;"><fmt:formatDate value="${invest.investTime}" type="both" pattern="yyyy/MM/dd HH:mm:ss"/></li>
					                     <li class="w137" style="width: 180px;">${invest.status.text}</li>
					                 </ol>
				                 </c:forEach>
				             </div>
                        </div>
                        <div style="display:none;" id="tagContent6"><!--活动详情  -->
                           	${borrowInfo.active_desc }
                        </div>
                    </div>
                </div>      
            </div>
        </div>
    	<!--主体-->
    	
    	<!--foot-->
        <c:import url="../include/foot.jsp"></c:import>
        <!--foot-->    
</body>
</html>
